<?php
	include 'commonAccountFunctions.php';
	
	session_start();
	
	$user = checkAuthentication();
	
	print_header();
	
	if(getPermissions($user)==="labman"){
		printCommonCP();
		printLabmanCP();
	} elseif(getPermissions($user)==="labins"){
		printCommonCP();
		printLabinsCP();
	} elseif(getPermissions($user)==="labaud"){ // otherwise, lab auditor
		printCommonCP();
	} else{ // someone dun tried to hack our system
		header('Location: index.php');
		exit();
	}
	
	print_footer();
	
		
	// void -> HTML
	// prints out the common HTML that all accounts see
	function printCommonCP(){
		global $user;
?>
	<div id="userDiv">
		<p id="userName">UserName: <?= $user ?></p>
		<form action="index.php" method="post">
			<button type='submit' class="unButtons">Log Out</button>
		</form>
		<form action="changePassword.php" method="post">
			<button type="submit" class="unButtons">Change Password</button>
		</form>
	</div>
	<div id="buttonDiv">
		<form action="completedLists.php" method="post">
			<button type="submit" class="buttonsRight">View Completed Checklists</button>
		</form>
<?php
	}
	
	// void -> HTML
	// prints out the HTML pertaining only to the lab manager
	function printLabmanCP(){
?>
		<form action="newInspection.php" method="post">
			<button class="buttonsLeft" type="submit">Inspect Lab</button>
		</form>
		<form action="manageUserAccounts.php" method="post">
			<button class="buttonsLeft" type="submit">Manage User Accounts</button>
		</form>
	</div>
<?php
	}
	
	// void -> HTML
	// prints out the HTML pertaining only to the lab inspector
	function printLabinsCP(){
?>
		<form action="newInspection.php" method="post">
			<button class="buttonsLeft" type="submit">Inspect Lab</button>
		</form>
	</div>
<?php
	}

?>